package cn.kgc.shiro02.utils;

import java.util.Random;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/4/6
 * @Description: 随机盐工具类
 */
public class SaltUtil {
    
    public static String getSalt(Integer length){

        char[] chars = "zxcvbnmasdfghjklqwertyuiopZXCVBNMASDFGHJKLQWERTYUIO,.!@#$%^&*".toCharArray();
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i <length; i++) {
            int number = random.nextInt(chars.length);
            stringBuilder.append(chars[number]);
        }
        return stringBuilder.toString();
    }
}
